import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  ManyToMany,
} from 'typeorm';
import { Tool } from '../../tools/entities/tool.entity';

/**
 * 标签实体
 */
@Entity('tags')
export class Tag {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 50, unique: true })
  name: string;

  @Column({ length: 50, unique: true })
  slug: string;

  // 关联关系
  @ManyToMany(() => Tool, (tool) => tool.tags)
  tools: Tool[];
}







